//
//  studyListCollectionCell.m
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/16.
//  Copyright © 2021 shengYang. All rights reserved.
//

#import "studyListCollectionCell.h"

@implementation studyListCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.back_img.image = [UIImage imageNamed:@"study_cellImg"];
    [self.contentView insertSubview:self.back_img atIndex:0];
    self.name_lab.font = AutoLabFont2;
    self.age_lab.font = self.easy_lab.font = self.status_lab.font = self.pingji_lab.font = self.time_lab.font = self.look_lab.font = self.like_lab.font = self.free_lab.font = AutoLabFont3;
    self.free_lab.font = [UIFont systemFontOfSize:([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone ? 8.0f : 18.0f)];
    [self.cover_view setHidden:YES];
}

-(void)setModel:(CurriculumListModel *)model{
    _model = model;
    if ([model.coursePayType intValue] == 1) {
        _free_lab.text = [NSString stringWithFormat:@" 付费 "];
        _free_lab.backgroundColor = [UIColor redColor];
        [self.cover_view setHidden:NO];
    }else{
      _free_lab.text = [NSString stringWithFormat:@" 免费 "];
        _free_lab.backgroundColor = [UIColor colorWithHexString:@"#34A444"];
        [self.cover_view setHidden:YES];
    }
    APPViewBorderRadius(self.free_lab, self.free_lab.frame.size.height/3, .1, [UIColor clearColor]);    
    APPViewBorderRadius(self.cover_view, 10, .1, [UIColor clearColor]);
    APPViewBorderRadius(self.icon_img, 10, .1, [UIColor clearColor]);
    [self.icon_img sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",model.courseIcon]] placeholderImage:DefaultImg];
    _name_lab.text = [NSString stringWithFormat:@"%@",model.courseName];
    _age_lab.text = [NSString stringWithFormat:@"适合年龄:%@",model.courseAge];
    _easy_lab.text = [NSString stringWithFormat:@"课程级别:%@",model.levelName];
    _status_lab.text = [NSString stringWithFormat:@"场景:%@",model.courseScene];
    _time_lab.text = [NSString stringWithFormat:@"课程时长:%@小时",model.courseTime];
    _look_lab.text = [NSString stringWithFormat:@"%@",model.courseLook];
    _like_lab.text = [NSString stringWithFormat:@"%@",model.coursePraise];
    //星星展示
    if ([model.courseDifficulty intValue] == 0) {
        self.star1.hidden = self.star2.hidden = self.star3.hidden = self.star4.hidden = YES;
    }else if ([model.courseDifficulty intValue] == 1){
        self.star1.hidden = NO;
        self.star2.hidden = self.star3.hidden = self.star4.hidden = YES;
    }else if ([model.courseDifficulty intValue] == 2){
        self.star1.hidden = self.star2.hidden = NO;
        self.star3.hidden = self.star4.hidden = YES;
    }else if ([model.courseDifficulty intValue] == 3){
        self.star1.hidden = self.star2.hidden = self.star3.hidden = NO;
        self.star4.hidden = YES;
    }else if ([model.courseDifficulty intValue] == 4){
        self.star1.hidden = self.star2.hidden = self.star3.hidden = self.star4.hidden = NO;
    }
    
}

@end
